home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / system.int < prev    next >
Encoding:
Text File  |  1998-02-09  |  26.2 KB  |  786 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       Delphi Runtime Library                          }
  4. {       System Unit                                     }
  5. {                                                       }
  6. {       Copyright (C) 1988,98 Borland International     }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit System;        // $Revision:   1.7.2.1  $
  11.  
  12. {$H+,I-,S-}
  13.  
  14. interface
  15.  
  16. const
  17.  
  18. { Variant type codes }
  19.  
  20.   varEmpty    = $0000;
  21.   varNull     = $0001;
  22.   varSmallint = $0002;
  23.   varInteger  = $0003;
  24.   varSingle   = $0004;
  25.   varDouble   = $0005;
  26.   varCurrency = $0006;
  27.   varDate     = $0007;
  28.   varOleStr   = $0008;
  29.   varDispatch = $0009;
  30.   varError    = $000A;
  31.   varBoolean  = $000B;
  32.   varVariant  = $000C;
  33.   varUnknown  = $000D;
  34.   varByte     = $0011;
  35.   varString   = $0100;
  36.   varTypeMask = $0FFF;
  37.   varArray    = $2000;
  38.   varByRef    = $4000;
  39.  
  40. { TVarRec.VType values }
  41.  
  42.   vtInteger    = 0;
  43.   vtBoolean    = 1;
  44.   vtChar       = 2;
  45.   vtExtended   = 3;
  46.   vtString     = 4;
  47.   vtPointer    = 5;
  48.   vtPChar      = 6;
  49.   vtObject     = 7;
  50.   vtClass      = 8;
  51.   vtWideChar   = 9;
  52.   vtPWideChar  = 10;
  53.   vtAnsiString = 11;
  54.   vtCurrency   = 12;
  55.   vtVariant    = 13;
  56.   vtInterface  = 14;
  57.   vtWideString = 15;
  58.  
  59. { Virtual method table entries }
  60.  
  61.   vmtSelfPtr           = -76;
  62.   vmtIntfTable         = -72;
  63.   vmtAutoTable         = -68;
  64.   vmtInitTable         = -64;
  65.   vmtTypeInfo          = -60;
  66.   vmtFieldTable        = -56;
  67.   vmtMethodTable       = -52;
  68.   vmtDynamicTable      = -48;
  69.   vmtClassName         = -44;
  70.   vmtInstanceSize      = -40;
  71.   vmtParent            = -36;
  72.   vmtSafeCallException = -32;
  73.   vmtAfterConstruction = -28;
  74.   vmtBeforeDestruction = -24;
  75.   vmtDispatch          = -20;
  76.   vmtDefaultHandler    = -16;
  77.   vmtNewInstance       = -12;
  78.   vmtFreeInstance      = -8;
  79.   vmtDestroy           = -4;
  80.  
  81.   vmtQueryInterface    = 0;
  82.   vmtAddRef            = 4;
  83.   vmtRelease           = 8;
  84.   vmtCreateObject      = 12;
  85.  
  86. type
  87.  
  88.   TObject = class;
  89.  
  90.   TClass = class of TObject;
  91.  
  92.   {$EXTERNALSYM HRESULT}
  93.   HRESULT = type Longint;  { from WTYPES.H }
  94.  
  95. {$EXTERNALSYM IUnknown}
  96. {$EXTERNALSYM IDispatch}
  97.  
  98.   PGUID = ^TGUID;
  99.   TGUID = record
  100.     D1: Integer;
  101.     D2: Word;
  102.     D3: Word;
  103.     D4: array[0..7] of Byte;
  104.   end;
  105.  
  106.   PInterfaceEntry = ^TInterfaceEntry;
  107.   TInterfaceEntry = record
  108.     IID: TGUID;
  109.     VTable: Pointer;
  110.     IOffset: Integer;
  111.   end;
  112.  
  113.   PInterfaceTable = ^TInterfaceTable;
  114.   TInterfaceTable = record
  115.     EntryCount: Integer;
  116.     Entries: array[0..9999] of TInterfaceEntry;
  117.   end;
  118.  
  119.   TObject = class
  120.     constructor Create;
  121.     procedure Free;
  122.     class function InitInstance(Instance: Pointer): TObject;
  123.     procedure CleanupInstance;
  124.     function ClassType: TClass;
  125.     class function ClassName: ShortString;
  126.     class function ClassNameIs(const Name: string): Boolean;
  127.     class function ClassParent: TClass;
  128.     class function ClassInfo: Pointer;
  129.     class function InstanceSize: Longint;
  130.     class function InheritsFrom(AClass: TClass): Boolean;
  131.     class function MethodAddress(const Name: ShortString): Pointer;
  132.     class function MethodName(Address: Pointer): ShortString;
  133.     function FieldAddress(const Name: ShortString): Pointer;
  134.     function GetInterface(const IID: TGUID; out Obj): Boolean;
  135.     class function GetInterfaceEntry(const IID: TGUID): PInterfaceEntry;
  136.     class function GetInterfaceTable: PInterfaceTable;
  137.     function SafeCallException(ExceptObject: TObject;
  138.       ExceptAddr: Pointer): HResult; virtual;
  139.     procedure AfterConstruction; virtual;
  140.     procedure BeforeDestruction; virtual;
  141.     procedure Dispatch(var Message); virtual;
  142.     procedure DefaultHandler(var Message); virtual;
  143.     class function NewInstance: TObject; virtual;
  144.     procedure FreeInstance; virtual;
  145.     destructor Destroy; virtual;
  146.   end;
  147.  
  148.   IUnknown = interface
  149.     ['{00000000-0000-0000-C000-000000000046}']
  150.     function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
  151.     function _AddRef: Integer; stdcall;
  152.     function _Release: Integer; stdcall;
  153.   end;
  154.  
  155.   IDispatch = interface(IUnknown)
  156.     ['{00020400-0000-0000-C000-000000000046}']
  157.     function GetTypeInfoCount(out Count: Integer): HResult; stdcall;
  158.     function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall;
  159.     function GetIDsOfNames(const IID: TGUID; Names: Pointer;
  160.       NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall;
  161.     function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer;
  162.       Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall;
  163.   end;
  164.  
  165.   TInterfacedObject = class(TObject, IUnknown)
  166.   protected
  167.     FRefCount: Integer;
  168.     function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
  169.     function _AddRef: Integer; stdcall;
  170.     function _Release: Integer; stdcall;
  171.   public
  172.     property RefCount: Integer;
  173.     destructor Destroy; override;
  174.   end;
  175.  
  176.   TInterfacedClass = class of TInterfacedObject;
  177.  
  178.   TVarArrayBound = record
  179.     ElementCount: Integer;
  180.     LowBound: Integer;
  181.   end;
  182.  
  183.   PVarArray = ^TVarArray;
  184.   TVarArray = record
  185.     DimCount: Word;
  186.     Flags: Word;
  187.     ElementSize: Integer;
  188.     LockCount: Integer;
  189.     Data: Pointer;
  190.     Bounds: array[0..255] of TVarArrayBound;
  191.   end;
  192.  
  193.   PVarData = ^TVarData;
  194.   TVarData = record
  195.     VType: Word;
  196.     Reserved1, Reserved2, Reserved3: Word;
  197.     case Integer of
  198.       varSmallint: (VSmallint: Smallint);
  199.       varInteger:  (VInteger: Integer);
  200.       varSingle:   (VSingle: Single);
  201.       varDouble:   (VDouble: Double);
  202.       varCurrency: (VCurrency: Currency);
  203.       varDate:     (VDate: Double);
  204.       varOleStr:   (VOleStr: PWideChar);
  205.       varDispatch: (VDispatch: Pointer);
  206.       varError:    (VError: Integer);
  207.       varBoolean:  (VBoolean: WordBool);
  208.       varUnknown:  (VUnknown: Pointer);
  209.       varByte:     (VByte: Byte);
  210.       varString:   (VString: Pointer);
  211.       varArray:    (VArray: PVarArray);
  212.       varByRef:    (VPointer: Pointer);
  213.   end;
  214.  
  215.   PShortString = ^ShortString;
  216.   PAnsiString = ^AnsiString;
  217.   PWideString = ^WideString;
  218.   PString = PAnsiString;
  219.  
  220.   PExtended = ^Extended;
  221.   PCurrency = ^Currency;
  222.   PVariant = ^Variant;
  223.   POleVariant = ^OleVariant;
  224.  
  225.   TDateTime = type Double;
  226.  
  227.   PVarRec = ^TVarRec;
  228.   TVarRec = record
  229.     case Byte of
  230.       vtInteger:    (VInteger: Integer; VType: Byte);
  231.       vtBoolean:    (VBoolean: Boolean);
  232.       vtChar:       (VChar: Char);
  233.       vtExtended:   (VExtended: PExtended);
  234.       vtString:     (VString: PShortString);
  235.       vtPointer:    (VPointer: Pointer);
  236.       vtPChar:      (VPChar: PChar);
  237.       vtObject:     (VObject: TObject);
  238.       vtClass:      (VClass: TClass);
  239.       vtWideChar:   (VWideChar: WideChar);
  240.       vtPWideChar:  (VPWideChar: PWideChar);
  241.       vtAnsiString: (VAnsiString: Pointer);
  242.       vtCurrency:   (VCurrency: PCurrency);
  243.       vtVariant:    (VVariant: PVariant);
  244.       vtInterface:  (VInterface: Pointer);
  245.       vtWideString: (VWideString: Pointer);
  246.   end;
  247.  
  248.   PMemoryManager = ^TMemoryManager;
  249.   TMemoryManager = record
  250.     GetMem: function(Size: Integer): Pointer;
  251.     FreeMem: function(P: Pointer): Integer;
  252.     ReallocMem: function(P: Pointer; Size: Integer): Pointer;
  253.   end;
  254.  
  255.   THeapStatus = record
  256.     TotalAddrSpace: Cardinal;
  257.     TotalUncommitted: Cardinal;
  258.     TotalCommitted: Cardinal;
  259.     TotalAllocated: Cardinal;
  260.     TotalFree: Cardinal;
  261.     FreeSmall: Cardinal;
  262.     FreeBig: Cardinal;
  263.     Unused: Cardinal;
  264.     Overhead: Cardinal;
  265.     HeapErrorCode: Cardinal;
  266.   end;
  267.  
  268.   PackageUnitEntry = record
  269.     Init, FInit : procedure;
  270.   end;
  271.  
  272.   { Compiler generated table to be processed sequentially to init & finit all package units }
  273.   { Init: 0..Max-1; Final: Last Initialized..0                                              }
  274.   UnitEntryTable = array [0..9999999] of PackageUnitEntry;
  275.   PUnitEntryTable = ^UnitEntryTable;
  276.  
  277.   PackageInfoTable = record
  278.     UnitCount : Integer;      { number of entries in UnitInfo array; always > 0 }
  279.     UnitInfo : PUnitEntryTable;
  280.   end;
  281.  
  282.   PackageInfo = ^PackageInfoTable;
  283.  
  284.   { Each package exports a '@GetPackageInfoTable' which can be used to retrieve }
  285.   { the table which contains compiler generated information about the package DLL }
  286.   GetPackageInfoTable = function : PackageInfo;
  287.  
  288. threadvar
  289.  
  290.   RaiseList: Pointer;     { Stack of current exception objects }
  291.   InOutRes: Integer;      { Result of I/O operations }
  292.  
  293. var
  294.  
  295.   ExceptProc: Pointer;    { Unhandled exception handler }
  296.   ErrorProc: Pointer;     { Error handler procedure }
  297.   ExceptClsProc: Pointer; { Map an OS Exception to a Delphi class reference }
  298.   ExceptObjProc: Pointer; { Map an OS Exception to a Delphi class instance }
  299.   ExceptionClass: TClass; { Exception base class (must be Exception) }
  300.   SafeCallErrorProc: Pointer; { Safecall error handler }
  301.   AssertErrorProc: Pointer; { Assertion error handler }
  302.   AbstractErrorProc: Pointer; { Abstract method error handler }
  303.   HPrevInst: Integer;     { Handle of previous instance }
  304.   MainInstance: Integer;  { Handle of the main(.EXE) HInstance }
  305.   IsLibrary: Boolean;     { True if module is a DLL }
  306.   CmdShow: Integer;       { CmdShow parameter for CreateWindow }
  307.   CmdLine: PChar;         { Command line pointer }
  308.   InitProc: Pointer;      { Last installed initialization procedure }
  309.   ExitCode: Integer;      { Program result }
  310.   ExitProc: Pointer;      { Last installed exit procedure }
  311.   ErrorAddr: Pointer;     { Address of run-time error }
  312.   RandSeed: Longint;      { Base for random number generator }
  313.   IsConsole: Boolean;     { True if compiled as console app }
  314.   IsMultiThread: Boolean; { True if more than one thread }
  315.   FileMode: Byte;         { Standard mode for opening files }
  316.   Test8086: Byte;         { Will always be 2 (386 or later) }
  317.   Test8087: Byte;         { Will always be 3 (387 or later) }
  318.   TestFDIV: Shortint;     { -1: Flawed Pentium, 0: Not determined, 1: Ok }
  319.   Input: Text;            { Standard input }
  320.   Output: Text;           { Standard output }
  321.  
  322.  
  323. var
  324.   Default8087CW: Word = $1332;{ Default 8087 control word.  FPU control
  325.                                 register is set to this value.
  326.                                 CAUTION:  Setting this to an invalid value
  327.                                           could cause unpredictable behaiour. }
  328.   HeapAllocFlags: Word = 2;   { Heap allocation flags, gmem_Moveable }
  329.   DebugHook: Byte = 0;        {  1 to notify debugger of non-Delphi exceptions
  330.                                  >1 to notify debugger of exception unwinding }
  331.  
  332. var
  333.   Unassigned: Variant;    { Unassigned standard constant }
  334.   Null: Variant;          { Null standard constant }
  335.  
  336.   AllocMemCount: Integer; { Number of allocated memory blocks }
  337.   AllocMemSize: Integer;  { Total size of allocated memory blocks }
  338.  
  339. { Memory manager support }
  340.  
  341. procedure GetMemoryManager(var MemMgr: TMemoryManager);
  342. procedure SetMemoryManager(const MemMgr: TMemoryManager);
  343. function IsMemoryManagerSet: Boolean;
  344.  
  345. function SysGetMem(Size: Integer): Pointer;
  346. function SysFreeMem(P: Pointer): Integer;
  347. function SysReallocMem(P: Pointer; Size: Integer): Pointer;
  348.  
  349. function GetHeapStatus: THeapStatus;
  350.  
  351. { Thread support }
  352. type
  353.   TThreadFunc = function(Parameter: Pointer): Integer;
  354.  
  355. function BeginThread(SecurityAttributes: Pointer; StackSize: Integer;
  356.                      ThreadFunc: TThreadFunc; Parameter: Pointer;
  357.                      CreationFlags: Integer; var ThreadId: Integer): Integer;
  358.  
  359. procedure EndThread(ExitCode: Integer);
  360.  
  361. { Standard procedures and functions }
  362.  
  363. procedure _ChDir(const S: string);
  364. procedure __Flush(var F: Text);
  365. procedure _LGetDir(D: Byte; var S: string);
  366. procedure _SGetDir(D: Byte; var S: ShortString);
  367. function IOResult: Integer;
  368. procedure _MkDir(const S: string);
  369. procedure Move(const Source; var Dest; Count: Integer);
  370. function ParamCount: Integer;
  371. function ParamStr(Index: Integer): string;
  372. procedure Randomize;
  373. procedure _RmDir(const S: string);
  374. function UpCase(Ch: Char): Char;
  375.  
  376. { Control 8087 control word }
  377.  
  378. procedure Set8087CW(NewCW: Word);
  379.  
  380. { Wide character support procedures and functions }
  381.  
  382. function WideCharToString(Source: PWideChar): string;
  383. function WideCharLenToString(Source: PWideChar; SourceLen: Integer): string;
  384. procedure WideCharToStrVar(Source: PWideChar; var Dest: string);
  385. procedure WideCharLenToStrVar(Source: PWideChar; SourceLen: Integer;
  386.   var Dest: string);
  387. function StringToWideChar(const Source: string; Dest: PWideChar;
  388.   DestSize: Integer): PWideChar;
  389.  
  390. { OLE string support procedures and functions }
  391.  
  392. function OleStrToString(Source: PWideChar): string;
  393. procedure OleStrToStrVar(Source: PWideChar; var Dest: string);
  394. function StringToOleStr(const Source: string): PWideChar;
  395.  
  396. { Variant support procedures and functions }
  397.  
  398. procedure _VarClear(var V : Variant);
  399. procedure _VarCopy(var Dest : Variant; const Source: Variant);
  400. procedure _VarCast(var Dest : Variant; const Source: Variant; VarType: Integer);
  401. procedure _VarCastOle(var Dest : Variant; const Source: Variant; VarType: Integer);
  402. procedure VarCopyNoInd(var Dest: Variant; const Source: Variant);
  403. function VarType(const V: Variant): Integer;
  404. function VarAsType(const V: Variant; VarType: Integer): Variant;
  405. function VarIsEmpty(const V: Variant): Boolean;
  406. function VarIsNull(const V: Variant): Boolean;
  407. function VarToStr(const V: Variant): string;
  408. function VarFromDateTime(DateTime: TDateTime): Variant;
  409. function VarToDateTime(const V: Variant): TDateTime;
  410.  
  411. { Variant array support procedures and functions }
  412.  
  413. function VarArrayCreate(const Bounds: array of Integer;
  414.   VarType: Integer): Variant;
  415. function VarArrayOf(const Values: array of Variant): Variant;
  416. procedure _VarArrayRedim(var A : Variant; HighBound: Integer);
  417. function VarArrayDimCount(const A: Variant): Integer;
  418. function VarArrayLowBound(const A: Variant; Dim: Integer): Integer;
  419. function VarArrayHighBound(const A: Variant; Dim: Integer): Integer;
  420. function VarArrayLock(const A: Variant): Pointer;
  421. procedure VarArrayUnlock(const A: Variant);
  422. function VarArrayRef(const A: Variant): Variant;
  423. function VarIsArray(const A: Variant): Boolean;
  424.  
  425. { Variant IDispatch call support }
  426.  
  427. procedure _DispInvokeError;
  428.  
  429. var
  430.   VarDispProc: Pointer = @_DispInvokeError;
  431.   DispCallByIDProc: Pointer = @_DispInvokeError;
  432.  
  433. { Package/Module registration and unregistration }
  434.  
  435. type
  436.   PLibModule = ^TLibModule;
  437.   TLibModule = record
  438.     Next: PLibModule;
  439.     Instance: Integer;
  440.     CodeInstance: Integer;
  441.     DataInstance: Integer;
  442.     ResInstance: Integer;
  443.     Reserved: Integer;
  444.   end;
  445.  
  446.   TEnumModuleFunc = function (HInstance: Integer; Data: Pointer): Boolean;
  447.   TModuleUnloadProc = procedure (HInstance: Integer);
  448.  
  449.   PModuleUnloadRec = ^TModuleUnloadRec;
  450.   TModuleUnloadRec = record
  451.     Next: PModuleUnloadRec;
  452.     Proc: TModuleUnloadProc;
  453.   end;
  454.  
  455. var
  456.   LibModuleList: PLibModule = nil;
  457.   ModuleUnloadList: PModuleUnloadRec = nil;
  458.  
  459. procedure RegisterModule(LibModule: PLibModule);
  460. procedure UnregisterModule(LibModule: PLibModule);
  461. function FindHInstance(Address: Pointer): Longint;
  462. function FindClassHInstance(ClassType: TClass): Longint;
  463. function FindResourceHInstance(Instance: Longint): Longint;
  464. function LoadResourceModule(ModuleName: PChar): Longint;
  465. procedure EnumModules(Func: TEnumModuleFunc; Data: Pointer);
  466. procedure EnumResourceModules(Func: TEnumModuleFunc; Data: Pointer);
  467. procedure AddModuleUnloadProc(Proc: TModuleUnloadProc);
  468. procedure RemoveModuleUnloadProc(Proc: TModuleUnloadProc);
  469.  
  470. { ResString support function/record }
  471.  
  472. type
  473.   PResStringRec = ^TResStringRec;
  474.   TResStringRec = record
  475.     Module: ^Longint;
  476.     Identifier: Integer;
  477.   end;
  478.  
  479. function LoadResString(ResStringRec: PResStringRec): string;
  480.  
  481. { Procedures and functions that need compiler magic }
  482.  
  483. procedure _COS;
  484. procedure _EXP;
  485. procedure _INT;
  486. procedure _SIN;
  487. procedure _FRAC;
  488. procedure _ROUND;
  489. procedure _TRUNC;
  490.  
  491. procedure _AbstractError;
  492. procedure _Assert(const Message, Filename: AnsiString; LineNumber: Integer);
  493. procedure _Append;
  494. procedure _Assign(var T: Text; S: ShortString);
  495. procedure _BlockRead;
  496. procedure _BlockWrite;
  497. procedure _Close;
  498. procedure _PStrCat;
  499. procedure _PStrNCat;
  500. procedure _PStrCpy;
  501. procedure _PStrNCpy;
  502. procedure _EofFile;
  503. procedure _EofText;
  504. procedure _Eoln;
  505. procedure _Erase;
  506. procedure _FilePos;
  507. procedure _FileSize;
  508. procedure _FillChar;
  509. procedure _FreeMem;
  510. procedure _GetMem;
  511. procedure _ReallocMem;
  512. procedure _Halt;
  513. procedure _Halt0;
  514. procedure _Mark;
  515. procedure _PStrCmp;
  516. procedure _AStrCmp;
  517. procedure _RandInt;
  518. procedure _RandExt;
  519. procedure _ReadRec;
  520. procedure _ReadChar;
  521. procedure _ReadLong;
  522. procedure _ReadString;
  523. procedure _ReadCString;
  524. procedure _ReadLString;
  525. procedure _ReadExt;
  526. procedure _ReadLn;
  527. procedure _Rename;
  528. procedure _Release;
  529. procedure _ResetText(var T: Text);
  530. procedure _ResetFile;
  531. procedure _RewritText(var T: Text);
  532. procedure _RewritFile;
  533. procedure _RunError;
  534. procedure _Run0Error;
  535. procedure _Seek;
  536. procedure _SeekEof;
  537. procedure _SeekEoln;
  538. procedure _SetTextBuf;
  539. procedure _StrLong;
  540. procedure _Str0Long;
  541. procedure _Truncate;
  542. procedure _ValLong;
  543. procedure _WriteRec;
  544. procedure _WriteChar;
  545. procedure _Write0Char;
  546. procedure _WriteBool;
  547. procedure _Write0Bool;
  548. procedure _WriteLong;
  549. procedure _Write0Long;
  550. procedure _WriteString;
  551. procedure _Write0String;
  552. procedure _WriteCString;
  553. procedure _Write0CString;
  554. procedure _WriteLString;
  555. procedure _Write0LString;
  556. function _WriteVariant(var T: Text; const V: Variant; Width: Integer): Pointer;
  557. function _Write0Variant(var T: Text; const V: Variant): Pointer;
  558. procedure _Write2Ext;
  559. procedure _Write1Ext;
  560. procedure _Write0Ext;
  561. procedure _WriteLn;
  562.  
  563. procedure __CToPasStr;
  564. procedure __CLenToPasStr;
  565. procedure __ArrayToPasStr;
  566. procedure __PasToCStr;
  567.  
  568. procedure __IOTest;
  569. procedure _Flush(var F: Text);
  570.  
  571. procedure _SetElem;
  572. procedure _SetRange;
  573. procedure _SetEq;
  574. procedure _SetLe;
  575. procedure _SetIntersect;
  576. procedure _SetUnion;
  577. procedure _SetSub;
  578. procedure _SetExpand;
  579.  
  580. procedure _Str2Ext;
  581. procedure _Str0Ext;
  582. procedure _Str1Ext;
  583. procedure _ValExt;
  584. procedure _Pow10;
  585. procedure _Real2Ext;
  586. procedure _Ext2Real;
  587.  
  588. procedure _ObjSetup;
  589. procedure _ObjCopy;
  590. procedure _Fail;
  591. procedure _BoundErr;
  592. procedure _IntOver;
  593. procedure _StartExe;
  594. procedure _StartLib;
  595. procedure _PackageLoad  (const Table : PackageInfo);
  596. procedure _PackageUnload(const Table : PackageInfo);
  597. procedure _InitResStrings;
  598. procedure _InitResStringImports;
  599. procedure _InitImports;
  600.  
  601. procedure _ClassCreate;
  602. procedure _ClassDestroy;
  603. procedure _AfterConstruction;
  604. procedure _BeforeDestruction;
  605. procedure _IsClass;
  606. procedure _AsClass;
  607.  
  608. procedure _RaiseExcept;
  609. procedure _RaiseAgain;
  610. procedure _DoneExcept;
  611. procedure _TryFinallyExit;
  612.  
  613. procedure _CallDynaInst;
  614. procedure _CallDynaClass;
  615. procedure _FindDynaInst;
  616. procedure _FindDynaClass;
  617.  
  618. procedure _LStrClr(var S: AnsiString);
  619. procedure _LStrArrayClr{var str: AnsiString; cnt: longint};
  620. procedure _LStrAsg{var dest: AnsiString; source: AnsiString};
  621. procedure _LStrLAsg{var dest: AnsiString; source: AnsiString};
  622. procedure _LStrFromPCharLen(var Dest: AnsiString; Source: PAnsiChar; Length: Integer);
  623. procedure _LStrFromPWCharLen(var Dest: AnsiString; Source: PWideChar; Length: Integer);
  624. procedure _LStrFromChar(var Dest: AnsiString; Source: AnsiChar);
  625. procedure _LStrFromWChar(var Dest: AnsiString; Source: WideChar);
  626. procedure _LStrFromPChar(var Dest: AnsiString; Source: PAnsiChar);
  627. procedure _LStrFromPWChar(var Dest: AnsiString; Source: PWideChar);
  628. procedure _LStrFromString(var Dest: AnsiString; const Source: ShortString);
  629. procedure _LStrFromArray(var Dest: AnsiString; Source: PAnsiChar; Length: Integer);
  630. procedure _LStrFromWArray(var Dest: AnsiString; Source: PWideChar; Length: Integer);
  631. procedure _LStrFromWStr(var Dest: AnsiString; const Source: WideString);
  632. procedure _LStrToString{(var Dest: ShortString; const Source: AnsiString; MaxLen: Integer)};
  633. function _LStrLen{str: AnsiString}: Longint;
  634. procedure _LStrCat{var dest: AnsiString; source: AnsiString};
  635. procedure _LStrCat3{var dest:AnsiString; source1: AnsiString; source2: AnsiString};
  636. procedure _LStrCatN{var dest:AnsiString; argCnt: Integer; ...};
  637. procedure _LStrCmp{left: AnsiString; right: AnsiString};
  638. procedure _LStrAddRef{str: AnsiString};
  639. procedure _LStrToPChar{str: AnsiString): PChar};
  640. procedure _Copy{ s : ShortString; index, count : Integer ) : ShortString};
  641. procedure _Delete{ var s : openstring; index, count : Integer };
  642. procedure _Insert{ source : ShortString; var s : openstring; index : Integer };
  643. procedure _Pos{ substr : ShortString; s : ShortString ) : Integer};
  644. procedure _SetLength{var s: ShortString; newLength: Integer};
  645. procedure _SetString{var s: ShortString: buffer: PChar; len: Integer};
  646.  
  647. procedure UniqueString(var str: string);
  648. procedure _NewAnsiString{length: Longint};      { for debugger purposes only }
  649.  
  650. procedure _LStrCopy  { const s : AnsiString; index, count : Integer) : AnsiString};
  651. procedure _LStrDelete{ var s : AnsiString; index, count : Integer };
  652. procedure _LStrInsert{ const source : AnsiString; var s : AnsiString; index : Integer };
  653. procedure _LStrPos{ const substr : AnsiString; const s : AnsiString ) : Integer};
  654. procedure _LStrSetLength{ var str: AnsiString; newLength: Integer};
  655. procedure _LStrOfChar{ c: Char; count: Integer): AnsiString };
  656.  
  657. procedure _WStrClr(var S: WideString);
  658. procedure _WStrArrayClr(var StrArray; Count: Integer);
  659. procedure _WStrAsg(var Dest: WideString; const Source: WideString);
  660. procedure _WStrFromPCharLen(var Dest: WideString; Source: PAnsiChar; Length: Integer);
  661. procedure _WStrFromPWCharLen(var Dest: WideString; Source: PWideChar; Length: Integer);
  662. procedure _WStrFromChar(var Dest: WideString; Source: AnsiChar);
  663. procedure _WStrFromWChar(var Dest: WideString; Source: WideChar);
  664. procedure _WStrFromPChar(var Dest: WideString; Source: PAnsiChar);
  665. procedure _WStrFromPWChar(var Dest: WideString; Source: PWideChar);
  666. procedure _WStrFromString(var Dest: WideString; const Source: ShortString);
  667. procedure _WStrFromArray(var Dest: WideString; Source: PAnsiChar; Length: Integer);
  668. procedure _WStrFromWArray(var Dest: WideString; Source: PWideChar; Length: Integer);
  669. procedure _WStrFromLStr(var Dest: WideString; const Source: AnsiString);
  670. procedure _WStrToString(Dest: PShortString; const Source: WideString; MaxLen: Integer);
  671. function _WStrToPWChar(const S: WideString): PWideChar;
  672. function _WStrLen(const S: WideString): Integer;
  673. procedure _WStrCat(var Dest: WideString; const Source: WideString);
  674. procedure _WStrCat3(var Dest: WideString; const Source1, Source2: WideString);
  675. procedure _WStrCatN{var dest:WideString; argCnt: Integer; ...};
  676. procedure _WStrCmp{left: WideString; right: WideString};
  677. function _NewWideString(Length: Integer): PWideChar;
  678. function _WStrCopy(const S: WideString; Index, Count: Integer): WideString;
  679. procedure _WStrDelete(var S: WideString; Index, Count: Integer);
  680. procedure _WStrInsert(const Source: WideString; var Dest: WideString; Index: Integer);
  681. procedure _WStrPos{ const substr : WideString; const s : WideString ) : Integer};
  682. procedure _WStrSetLength(var S: WideString; NewLength: Integer);
  683. function _WStrOfWChar(Ch: WideChar; Count: Integer): WideString;
  684. procedure _WStrAddRef{var str: WideString};
  685.  
  686. procedure _Initialize;
  687. procedure _InitializeArray;
  688. procedure _InitializeRecord;
  689. procedure _Finalize;
  690. procedure _FinalizeArray;
  691. procedure _FinalizeRecord;
  692. procedure _AddRef;
  693. procedure _AddRefArray;
  694. procedure _AddRefRecord;
  695. procedure _CopyArray;
  696. procedure _CopyRecord;
  697. procedure _CopyObject;
  698.  
  699. procedure _New;
  700. procedure _Dispose;
  701.  
  702. procedure _DispInvoke; cdecl;
  703. procedure _IntfDispCall; cdecl;
  704. procedure _IntfVarCall; cdecl;
  705.  
  706. procedure _VarToInt;
  707. procedure _VarToBool;
  708. procedure _VarToReal;
  709. procedure _VarToCurr;
  710. procedure _VarToPStr(var S; const V: Variant);
  711. procedure _VarToLStr(var S: string; const V: Variant);
  712. procedure _VarToWStr(var S: WideString; const V: Variant);
  713. procedure _VarToIntf(var Unknown: IUnknown; const V: Variant);
  714. procedure _VarToDisp(var Dispatch: IDispatch; const V: Variant);
  715.  
  716. procedure _VarFromInt;
  717. procedure _VarFromBool;
  718. procedure _VarFromReal;
  719. procedure _VarFromTDateTime;
  720. procedure _VarFromCurr;
  721. procedure _VarFromPStr(var V: Variant; const Value: ShortString);
  722. procedure _VarFromLStr(var V: Variant; const Value: string);
  723. procedure _VarFromWStr(var V: Variant; const Value: WideString);
  724. procedure _VarFromIntf(var V: Variant; const Value: IUnknown);
  725. procedure _VarFromDisp(var V: Variant; const Value: IDispatch);
  726. procedure _OleVarFromPStr(var V: OleVariant; const Value: ShortString);
  727. procedure _OleVarFromLStr(var V: OleVariant; const Value: string);
  728. procedure _OleVarFromVar(var V: OleVariant; const Value: Variant);
  729.  
  730. procedure _VarAdd;
  731. procedure _VarSub;
  732. procedure _VarMul;
  733. procedure _VarDiv;
  734. procedure _VarMod;
  735. procedure _VarAnd;
  736. procedure _VarOr;
  737. procedure _VarXor;
  738. procedure _VarShl;
  739. procedure _VarShr;
  740. procedure _VarRDiv;
  741. procedure _VarCmp;
  742.  
  743. procedure _VarNeg;
  744. procedure _VarNot;
  745.  
  746. procedure _VarCopyNoInd;
  747. procedure _VarClr;
  748. procedure _VarAddRef;
  749.  
  750. procedure _IntfClear(var Dest: IUnknown);
  751. procedure _IntfCopy(var Dest: IUnknown; const Source: IUnknown);
  752. procedure _IntfCast(var Dest: IUnknown; const Source: IUnknown; const IID: TGUID);
  753. procedure _IntfAddRef(const Dest: IUnknown);
  754.  
  755. function _VarArrayGet(var A: Variant; IndexCount: Integer;
  756.   Indices: Integer): Variant; cdecl;
  757. procedure _VarArrayPut(var A: Variant; const Value: Variant;
  758.   IndexCount: Integer; Indices: Integer); cdecl;
  759.  
  760. procedure _HandleAnyException;
  761. procedure _HandleOnException;
  762. procedure _HandleFinally;
  763. procedure _HandleAutoException;
  764.  
  765. procedure _FSafeDivide;
  766. procedure _FSafeDivideR;
  767.  
  768. procedure _CheckAutoResult;
  769.  
  770. procedure FPower10;
  771.  
  772. procedure TextStart;
  773.  
  774. function  CompToDouble(acomp: Comp): Double; cdecl;
  775. procedure DoubleToComp(adouble: Double; var result: Comp); cdecl;
  776. function  CompToCurrency(acomp: Comp): Currency; cdecl;
  777. procedure CurrencyToComp(acurrency: Currency; var result: Comp); cdecl;
  778.  
  779. function GetMemory(Size: Integer): Pointer; cdecl;
  780. function FreeMemory(P: Pointer): Integer; cdecl;
  781. function ReallocMemory(P: Pointer; Size: Integer): Pointer; cdecl;
  782.  
  783. (* =================================================================== *)
  784.  
  785. implementation
  786.